<?php
/* @var $this EventGiftPasswordController */
/* @var $model EventGiftPassword */
/* @var $form CActiveForm */
?>
<div id="update_form">
<!-- form start -->

<div class="zyWell">Fields with<span class="required">*</span>are required.</div>

<?php $form=$this->beginWidget('CActiveForm', array(
	'id'=>'event-gift-password-form',
	'enableAjaxValidation'=>false,
)); ?>
<?php 
$pass = $_GET['pass'];
$sate = $_GET['state'];
$expire_date=$_GET['expire_date'];
?>
<?php
if($sate == 2){
?>
	<p class="red"> <?php echo Yii::t('base','Winner,Unclaimed,Expired');?> </p>
<?php }elseif($sate == 4){?>
	<p class="red"> <?php echo Yii::t('base','This code has expired on ').$expire_date;?> </p>
<?php }elseif($sate == 5){?>
	<p class="red"> <?php echo Yii::t('base','Receiving Password does not exist or has been received');?> </p>
<?php }elseif($sate == 3){ ?>
	<p class="red"> <?php echo Yii::t('base','Winner,To accept the award');?> </p>
<?php }elseif($sate == 6){?>
	<p class="red"> <?php //echo Yii::t('base','Password exists, you can receive'); ?> </p>
<?php 
	$sql="select * from zy_event_gift_password where password='".$pass."'";
	$rs = Yii::app()->db->createCommand($sql)->queryAll();
} ?>
<?php echo $form->errorSummary($model); ?>
	<div class="row-fluid">
		<div class="span6">
			<div class="form-row control-group row-fluid">
				<?php echo $form->labelEx($model,Yii::t('base','Award Code')); ?>
					<div class="controls span7">
						<?php echo $form->passwordField($model,'password',array('size'=>50,'maxlength'=>50,'value'=>$pass)); ?>
						<?php echo $form->error($model,'password'); ?>
					</div>
			</div>
		</div>
		<div class="span6">
			<div class="form-row control-group row-fluid">
				<?php if($sate == 6){ ?>
				<?php echo $form->labelEx($model,'Device Serial Number'); ?>
				<div class="controls span7">
				<INPUT type="text" name="EventGiftPassword[service_number]" id="EventGiftPassword_service_number" value="<?php echo $rs[0]['service_number']; ?>" />
				</div>
				<?php  } ?>
			</div>
			</div>
	</div>
<div class="form-actions row-fluid">
	<div class="span7 offset3">
		<?php 
		if($sate == 6){
		echo CHtml::submitButton($model->isNewRecord ? Yii::t('base','To accept the award') : Yii::t('base','Save')); 
		}else{
			echo CHtml::submitButton($model->isNewRecord ? Yii::t('base','Verify') : Yii::t('base','Save'));
		}
		
		?>
	</div>
</div>
<?php $this->endWidget(); ?>
</div>
<!-- form -->